home *** CD-ROM | disk | FTP | other *** search
/ Amiga Plus 1995 #2 / Amiga Plus CD - 1995 - No. 2.iso / pd / mui / gravisimu / arexx / galaxie.rexx < prev    next >
OS/2 REXX Batch file  |  1995-04-11  |  2KB  |  119 lines

  1. /* Galaxie.rexx
  2.  *
  3.  * Autor: Thies Wellpott
  4.  * Version: 1.0 (2.7.1994)
  5.  *
  6.  * Erstellt eine kreisförmige Galaxie
  7.  *
  8.  * benötigt rexxmathlib.library
  9.  */
  10.  
  11. G = 6.67259e-11         /* Gravitationskonstante */
  12. PI = 3.1415927
  13.  
  14. Call Addlib("rexxmathlib.library",0,-30,0)
  15.  
  16. IF ~Show("P", "GRAVISIMU.1") THEN
  17. DO
  18.    Say "GraviSimu ist nicht gestartet!"
  19.    Exit
  20. END /* IF */
  21.  
  22. Address "GRAVISIMU.1"
  23. Options Results
  24.  
  25. 'GetNumObjects'
  26. IF Result > 0 THEN
  27.    Say "Achtung! Die vorhandenen Objekte können stören!"
  28.  
  29.  
  30. Options Prompt ">> "
  31.  
  32. Say "Galaxiename"
  33. Parse Pull a_name
  34. Say "Galaxiemasse (Kommazahl Leerzeichen Masseneinheitsabkürzung)"
  35. Parse Pull a_m a_m_einh
  36. 'GetUnitKG' a_m_einh
  37. IF RC ~= 0 THEN
  38. DO
  39.    Say "Ungültige Masseneinheit!"
  40.    Exit
  41. END
  42. a_m_kg = a_m * Result
  43.  
  44. Say "Koordinaten des Zentrums x/y (Kommazahl Leerzeichen Kommazahl"
  45. Say "Leerzeichen Streckeneinheitsabkürzung)"
  46. Parse Pull a_mx a_my a_mxy_einh
  47. 'GetUnitM' a_mxy_einh
  48. IF RC ~= 0 THEN
  49. DO
  50.    Say "Ungültige Masseneinheit!"
  51.    Exit
  52. END
  53. a_mx_m = a_mx * Result
  54. a_my_m = a_my * Result
  55.  
  56. Say "Geschwindigkeit des Zentrums vx/vy (Kommazahl Leerzeichen Kommazahl"
  57. Say "Leerzeichen Geschwindigkeitseinheitsabkürzung)"
  58. Parse Pull a_vx a_vy a_v_einh
  59. 'GetUnitMS' a_v_einh
  60. IF RC ~= 0 THEN
  61. DO
  62.    Say "Ungültige Masseneinheit!"
  63.    Exit
  64. END
  65. a_vx_ms = a_vx * Result
  66. a_vy_ms = a_vy * Result
  67.  
  68. Say "maximaler Radius der Galaxie (Kommazahl Leerzeichen"
  69. Say "Streckeneinheitsabkürzung)"
  70. Parse Pull a_r a_r_einh
  71. a_r = 100*9.46e15       /* Radius */
  72. 'GetUnitM' a_r_einh
  73. IF RC ~= 0 THEN
  74. DO
  75.    Say "Ungültige Streckeneinheit!"
  76.    Exit
  77. END
  78. a_r_m = a_r * Result
  79.  
  80. Say "Anzahl dargestellter Sterne der Galaxie (10 bis 1000)"
  81. Parse Pull a_anz
  82.  
  83.  
  84. 'NewObject "'a_name'"' a_m a_m_einh a_mx a_my a_mxy_einh a_vx a_vy a_v_einh '1 1 1 1'
  85. IF RC ~= 0 THEN
  86. DO
  87.    Say "Konnte Galaxiekern nicht hinzufügen!"
  88.    Exit
  89. END /* IF */
  90.  
  91. 'ObjectList QUIET'
  92. Say "Füge Sterne hinzu..."
  93. DO i=1 TO a_anz
  94.    w = Randu() * 2*PI
  95.    r = 0
  96.    DO FOR Random(1,4)         /* Dichte in der Mitte größer */
  97.       r = r + Randu() * a_r_m/4
  98.    END /* FOR */
  99.  
  100.    x = a_mx_m + r * Cos(w)
  101.    y = a_my_m + r * Sin(w)
  102.    v = Sqrt(G * a_m_kg / r)
  103.    vx = a_vx_ms + v * Cos(PI/2 + w)
  104.    vy = a_vy_ms + v * Sin(PI/2 + w)
  105.  
  106.    'NewObject "'a_name || i'" 1 mS' x y 'm' vx vy 'm/s 1 0 0 0'
  107. END /* i */
  108. 'ObjectList NOQUIET'
  109.  
  110. 'SetScale' a_r_m * 2 / 300 'm'
  111. max_v = Sqrt(G * a_m_kg / (a_r_m/20) )
  112. min_T = 2*PI * a_r_m/20 / max_v
  113. 'SetTime' min_T/100 's'
  114. 'SetParameter T=1 N=1'
  115. 'SetOptions BP=0 M=0'
  116.  
  117. Exit
  118.  
  119.